<?php
	/**
	 * The abstract TableProjectRequestCompleteGen class defined here is
	 * code-generated and contains all the basic CRUD-type functionality as well as
	 * basic methods to handle relationships and index-based loading.
	 *
	 * To use, you should use the TableProjectRequestComplete subclass which
	 * extends this TableProjectRequestCompleteGen class.
	 *
	 * Because subsequent re-code generations will overwrite any changes to this
	 * file, you should leave this file unaltered to prevent yourself from losing
	 * any information or code changes.  All customizations should be done by
	 * overriding existing or implementing new methods, properties and variables
	 * in the TableProjectRequestComplete class.
	 * 
	 * @package My Application
	 * @subpackage GeneratedDataObjects
	 * @property-read integer $Id the value for intId (Read-Only PK)
	 * @property integer $BuyerId the value for intBuyerId (Not Null)
	 * @property integer $ProviderId the value for intProviderId (Not Null)
	 * @property integer $ProjectId the value for intProjectId (Not Null)
	 * @property integer $CompleteType the value for intCompleteType (Not Null)
	 * @property string $Message the value for strMessage 
	 * @property QDateTime $RequestDate the value for dttRequestDate 
	 * @property QDateTime $AcceptDate the value for dttAcceptDate 
	 * @property QDateTime $DeclineDate the value for dttDeclineDate 
	 * @property QDateTime $RetractDate the value for dttRetractDate 
	 * @property QDateTime $ProjectFailedDate the value for dttProjectFailedDate 
	 * @property integer $Status the value for intStatus (Not Null)
	 * @property TableUserProject $Buyer the value for the TableUserProject object referenced by intBuyerId (Not Null)
	 * @property TableUserProject $Provider the value for the TableUserProject object referenced by intProviderId (Not Null)
	 * @property TableProject $Project the value for the TableProject object referenced by intProjectId (Not Null)
	 * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
	 */
	class TableProjectRequestCompleteGen extends QBaseClass {

		///////////////////////////////////////////////////////////////////////
		// PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
		///////////////////////////////////////////////////////////////////////
		
		/**
		 * Protected member variable that maps to the database PK Identity column table_project_request_complete.id
		 * @var integer intId
		 */
		protected $intId;
		const IdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_project_request_complete.buyer_id
		 * @var integer intBuyerId
		 */
		protected $intBuyerId;
		const BuyerIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_project_request_complete.provider_id
		 * @var integer intProviderId
		 */
		protected $intProviderId;
		const ProviderIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_project_request_complete.project_id
		 * @var integer intProjectId
		 */
		protected $intProjectId;
		const ProjectIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_project_request_complete.complete_type
		 * @var integer intCompleteType
		 */
		protected $intCompleteType;
		const CompleteTypeDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_project_request_complete.message
		 * @var string strMessage
		 */
		protected $strMessage;
		const MessageDefault = null;


		/**
		 * Protected member variable that maps to the database column table_project_request_complete.request_date
		 * @var QDateTime dttRequestDate
		 */
		protected $dttRequestDate;
		const RequestDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_project_request_complete.accept_date
		 * @var QDateTime dttAcceptDate
		 */
		protected $dttAcceptDate;
		const AcceptDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_project_request_complete.decline_date
		 * @var QDateTime dttDeclineDate
		 */
		protected $dttDeclineDate;
		const DeclineDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_project_request_complete.retract_date
		 * @var QDateTime dttRetractDate
		 */
		protected $dttRetractDate;
		const RetractDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_project_request_complete.project_failed_date
		 * @var QDateTime dttProjectFailedDate
		 */
		protected $dttProjectFailedDate;
		const ProjectFailedDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_project_request_complete.status
		 * @var integer intStatus
		 */
		protected $intStatus;
		const StatusDefault = 0;


		/**
		 * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
		 * columns from the run-time database query result for this object).  Used by InstantiateDbRow and
		 * GetVirtualAttribute.
		 * @var string[] $__strVirtualAttributeArray
		 */
		protected $__strVirtualAttributeArray = array();

		/**
		 * Protected internal member variable that specifies whether or not this object is Restored from the database.
		 * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
		 * @var bool __blnRestored;
		 */
		protected $__blnRestored;




		///////////////////////////////
		// PROTECTED MEMBER OBJECTS
		///////////////////////////////

		/**
		 * Protected member variable that contains the object pointed by the reference
		 * in the database column table_project_request_complete.buyer_id.
		 *
		 * NOTE: Always use the Buyer property getter to correctly retrieve this TableUserProject object.
		 * (Because this class implements late binding, this variable reference MAY be null.)
		 * @var TableUserProject objBuyer
		 */
		protected $objBuyer;

		/**
		 * Protected member variable that contains the object pointed by the reference
		 * in the database column table_project_request_complete.provider_id.
		 *
		 * NOTE: Always use the Provider property getter to correctly retrieve this TableUserProject object.
		 * (Because this class implements late binding, this variable reference MAY be null.)
		 * @var TableUserProject objProvider
		 */
		protected $objProvider;

		/**
		 * Protected member variable that contains the object pointed by the reference
		 * in the database column table_project_request_complete.project_id.
		 *
		 * NOTE: Always use the Project property getter to correctly retrieve this TableProject object.
		 * (Because this class implements late binding, this variable reference MAY be null.)
		 * @var TableProject objProject
		 */
		protected $objProject;





		///////////////////////////////
		// CLASS-WIDE LOAD AND COUNT METHODS
		///////////////////////////////

		/**
		 * Static method to retrieve the Database object that owns this class.
		 * @return QDatabaseBase reference to the Database object that can query this class
		 */
		public static function GetDatabase() {
			return QApplication::$Database[1];
		}

		/**
		 * Load a TableProjectRequestComplete from PK Info
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete
		 */
		public static function Load($intId, $objOptionalClauses = null) {
			// Use QuerySingle to Perform the Query
			return TableProjectRequestComplete::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableProjectRequestComplete()->Id, $intId)
				),
				$objOptionalClauses
			);
		}

		/**
		 * Load all TableProjectRequestCompletes
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete[]
		 */
		public static function LoadAll($objOptionalClauses = null) {
			if (func_num_args() > 1) {
				throw new QCallerException("LoadAll must be called with an array of optional clauses as a single argument");
			}
			// Call TableProjectRequestComplete::QueryArray to perform the LoadAll query
			try {
				return TableProjectRequestComplete::QueryArray(QQ::All(), $objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count all TableProjectRequestCompletes
		 * @return int
		 */
		public static function CountAll() {
			// Call TableProjectRequestComplete::QueryCount to perform the CountAll query
			return TableProjectRequestComplete::QueryCount(QQ::All());
		}




		///////////////////////////////
		// QCUBED QUERY-RELATED METHODS
		///////////////////////////////

		/**
		 * Internally called method to assist with calling Qcubed Query for this class
		 * on load methods.
		 * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
		 * @param boolean $blnCountOnly only select a rowcount
		 * @return string the query statement
		 */
		protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
			// Get the Database Object for this Class
			$objDatabase = TableProjectRequestComplete::GetDatabase();

			// Create/Build out the QueryBuilder object with TableProjectRequestComplete-specific SELET and FROM fields
			$objQueryBuilder = new QQueryBuilder($objDatabase, 'table_project_request_complete');
			TableProjectRequestComplete::GetSelectFields($objQueryBuilder);
			$objQueryBuilder->AddFromItem('table_project_request_complete');

			// Set "CountOnly" option (if applicable)
			if ($blnCountOnly)
				$objQueryBuilder->SetCountOnlyFlag();

			// Apply Any Conditions
			if ($objConditions)
				try {
					$objConditions->UpdateQueryBuilder($objQueryBuilder);
				} catch (QCallerException $objExc) {
					$objExc->IncrementOffset();
					throw $objExc;
				}

			// Iterate through all the Optional Clauses (if any) and perform accordingly
			if ($objOptionalClauses) {
				if ($objOptionalClauses instanceof QQClause)
					$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
				else if (is_array($objOptionalClauses))
					foreach ($objOptionalClauses as $objClause)
						$objClause->UpdateQueryBuilder($objQueryBuilder);
				else
					throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
			}

			// Get the SQL Statement
			$strQuery = $objQueryBuilder->GetStatement();

			// Prepare the Statement with the Query Parameters (if applicable)
			if ($mixParameterArray) {
				if (is_array($mixParameterArray)) {
					if (count($mixParameterArray))
						$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);

					// Ensure that there are no other Unresolved Named Parameters
					if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
						throw new QCallerException('Unresolved named parameters in the query');
				} else
					throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
			}

			// Return the Objects
			return $strQuery;
		}

		/**
		 * Static Qcubed Query method to query for a single TableProjectRequestComplete object.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableProjectRequestComplete the queried object
		 */
		public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableProjectRequestComplete::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
			
			// Perform the Query, Get the First Row, and Instantiate a new TableProjectRequestComplete object
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			
			// Do we have to expand anything?
			if ($objQueryBuilder->ExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableProjectRequestComplete::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, $objToReturn, $objQueryBuilder->ColumnAliasArray);
					if ($objItem)
						$objToReturn[] = $objItem;					
				}			
				// Since we only want the object to return, lets return the object and not the array.
				return $objToReturn[0];
			} else {
				// No expands just return the first row
				$objToReturn = null;
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn = TableProjectRequestComplete::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
			}
			
			return $objToReturn;
		}

		/**
		 * Static Qcubed Query method to query for an array of TableProjectRequestComplete objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableProjectRequestComplete[] the queried objects as an array
		 */
		public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableProjectRequestComplete::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and Instantiate the Array Result
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			return TableProjectRequestComplete::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
		}

		/**
		 * Static Qcubed Query method to query for a count of TableProjectRequestComplete objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return integer the count of queried objects as an integer
		 */
		public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableProjectRequestComplete::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and return the row_count
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);

			// Figure out if the query is using GroupBy
			$blnGrouped = false;

			if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
				if ($objClause instanceof QQGroupBy) {
					$blnGrouped = true;
					break;
				}
			}

			if ($blnGrouped)
				// Groups in this query - return the count of Groups (which is the count of all rows)
				return $objDbResult->CountRows();
			else {
				// No Groups - return the sql-calculated count(*) value
				$strDbRow = $objDbResult->FetchRow();
				return QType::Cast($strDbRow[0], QType::Integer);
			}
		}

		public static function QueryArrayCached(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableProjectRequestComplete::GetDatabase();

			$strQuery = TableProjectRequestComplete::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			
			$objCache = new QCache('qquery/tableprojectrequestcomplete', $strQuery);
			$cacheData = $objCache->GetData();
			
			if (!$cacheData || $blnForceUpdate) {
				$objDbResult = $objQueryBuilder->Database->Query($strQuery);
				$arrResult = TableProjectRequestComplete::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
				$objCache->SaveData(serialize($arrResult));
			} else {
				$arrResult = unserialize($cacheData);
			}
			
			return $arrResult;
		}

		/**
		 * Updates a QQueryBuilder with the SELECT fields for this TableProjectRequestComplete
		 * @param QQueryBuilder $objBuilder the Query Builder object to update
		 * @param string $strPrefix optional prefix to add to the SELECT fields
		 */
		public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
			if ($strPrefix) {
				$strTableName = $strPrefix;
				$strAliasPrefix = $strPrefix . '__';
			} else {
				$strTableName = 'table_project_request_complete';
				$strAliasPrefix = '';
			}

			$objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
			$objBuilder->AddSelectItem($strTableName, 'buyer_id', $strAliasPrefix . 'buyer_id');
			$objBuilder->AddSelectItem($strTableName, 'provider_id', $strAliasPrefix . 'provider_id');
			$objBuilder->AddSelectItem($strTableName, 'project_id', $strAliasPrefix . 'project_id');
			$objBuilder->AddSelectItem($strTableName, 'complete_type', $strAliasPrefix . 'complete_type');
			$objBuilder->AddSelectItem($strTableName, 'message', $strAliasPrefix . 'message');
			$objBuilder->AddSelectItem($strTableName, 'request_date', $strAliasPrefix . 'request_date');
			$objBuilder->AddSelectItem($strTableName, 'accept_date', $strAliasPrefix . 'accept_date');
			$objBuilder->AddSelectItem($strTableName, 'decline_date', $strAliasPrefix . 'decline_date');
			$objBuilder->AddSelectItem($strTableName, 'retract_date', $strAliasPrefix . 'retract_date');
			$objBuilder->AddSelectItem($strTableName, 'project_failed_date', $strAliasPrefix . 'project_failed_date');
			$objBuilder->AddSelectItem($strTableName, 'status', $strAliasPrefix . 'status');
		}



		///////////////////////////////
		// INSTANTIATION-RELATED METHODS
		///////////////////////////////

		/**
		 * Instantiate a TableProjectRequestComplete from a Database Row.
		 * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
		 * is calling this TableProjectRequestComplete::InstantiateDbRow in order to perform
		 * early binding on referenced objects.
		 * @param DatabaseRowBase $objDbRow
		 * @param string $strAliasPrefix
		 * @param string $strExpandAsArrayNodes
		 * @param QBaseClass $arrPreviousItem
		 * @param string[] $strColumnAliasArray
		 * @return TableProjectRequestComplete
		*/
		public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array()) {
			// If blank row, return null
			if (!$objDbRow) {
				return null;
			}

			// Create a new instance of the TableProjectRequestComplete object
			$objToReturn = new TableProjectRequestComplete();
			$objToReturn->__blnRestored = true;

			$strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
			$objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'buyer_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'buyer_id'] : $strAliasPrefix . 'buyer_id';
			$objToReturn->intBuyerId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'provider_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'provider_id'] : $strAliasPrefix . 'provider_id';
			$objToReturn->intProviderId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'project_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'project_id'] : $strAliasPrefix . 'project_id';
			$objToReturn->intProjectId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'complete_type', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'complete_type'] : $strAliasPrefix . 'complete_type';
			$objToReturn->intCompleteType = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'message', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'message'] : $strAliasPrefix . 'message';
			$objToReturn->strMessage = $objDbRow->GetColumn($strAliasName, 'Blob');
			$strAliasName = array_key_exists($strAliasPrefix . 'request_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'request_date'] : $strAliasPrefix . 'request_date';
			$objToReturn->dttRequestDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'accept_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'accept_date'] : $strAliasPrefix . 'accept_date';
			$objToReturn->dttAcceptDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'decline_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'decline_date'] : $strAliasPrefix . 'decline_date';
			$objToReturn->dttDeclineDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'retract_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'retract_date'] : $strAliasPrefix . 'retract_date';
			$objToReturn->dttRetractDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'project_failed_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'project_failed_date'] : $strAliasPrefix . 'project_failed_date';
			$objToReturn->dttProjectFailedDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'status', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'status'] : $strAliasPrefix . 'status';
			$objToReturn->intStatus = $objDbRow->GetColumn($strAliasName, 'Integer');

			if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
				foreach ($arrPreviousItems as $objPreviousItem) {
					if ($objToReturn->Id != $objPreviousItem->Id) {
						continue;
					}

					// complete match - all primary key columns are the same
					return null;
				}
			}

			// Instantiate Virtual Attributes
			foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
				$strVirtualPrefix = $strAliasPrefix . '__';
				$strVirtualPrefixLength = strlen($strVirtualPrefix);
				if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
					$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
			}

			// Prepare to Check for Early/Virtual Binding
			if (!$strAliasPrefix)
				$strAliasPrefix = 'table_project_request_complete__';

			// Check for Buyer Early Binding
			$strAlias = $strAliasPrefix . 'buyer_id__id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (!is_null($objDbRow->GetColumn($strAliasName)))
				$objToReturn->objBuyer = TableUserProject::InstantiateDbRow($objDbRow, $strAliasPrefix . 'buyer_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);

			// Check for Provider Early Binding
			$strAlias = $strAliasPrefix . 'provider_id__id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (!is_null($objDbRow->GetColumn($strAliasName)))
				$objToReturn->objProvider = TableUserProject::InstantiateDbRow($objDbRow, $strAliasPrefix . 'provider_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);

			// Check for Project Early Binding
			$strAlias = $strAliasPrefix . 'project_id__id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (!is_null($objDbRow->GetColumn($strAliasName)))
				$objToReturn->objProject = TableProject::InstantiateDbRow($objDbRow, $strAliasPrefix . 'project_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);




			return $objToReturn;
		}

		/**
		 * Instantiate an array of TableProjectRequestCompletes from a Database Result
		 * @param DatabaseResultBase $objDbResult
		 * @param string $strExpandAsArrayNodes
		 * @param string[] $strColumnAliasArray
		 * @return TableProjectRequestComplete[]
		 */
		public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
			$objToReturn = array();
			
			if (!$strColumnAliasArray)
				$strColumnAliasArray = array();

			// If blank resultset, then return empty array
			if (!$objDbResult)
				return $objToReturn;

			// Load up the return array with each row
			if ($strExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableProjectRequestComplete::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objToReturn, $strColumnAliasArray);
					if ($objItem) {
						$objToReturn[] = $objItem;
					}
				}
			} else {
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn[] = TableProjectRequestComplete::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
			}

			return $objToReturn;
		}



		///////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Single Load and Array)
		///////////////////////////////////////////////////
			
		/**
		 * Load a single TableProjectRequestComplete object,
		 * by Id Index(es)
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete
		*/
		public static function LoadById($intId, $objOptionalClauses = null) {
			return TableProjectRequestComplete::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableProjectRequestComplete()->Id, $intId)
				),
				$objOptionalClauses
			);
		}
			
		/**
		 * Load an array of TableProjectRequestComplete objects,
		 * by BuyerId Index(es)
		 * @param integer $intBuyerId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete[]
		*/
		public static function LoadArrayByBuyerId($intBuyerId, $objOptionalClauses = null) {
			// Call TableProjectRequestComplete::QueryArray to perform the LoadArrayByBuyerId query
			try {
				return TableProjectRequestComplete::QueryArray(
					QQ::Equal(QQN::TableProjectRequestComplete()->BuyerId, $intBuyerId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableProjectRequestCompletes
		 * by BuyerId Index(es)
		 * @param integer $intBuyerId
		 * @return int
		*/
		public static function CountByBuyerId($intBuyerId) {
			// Call TableProjectRequestComplete::QueryCount to perform the CountByBuyerId query
			return TableProjectRequestComplete::QueryCount(
				QQ::Equal(QQN::TableProjectRequestComplete()->BuyerId, $intBuyerId)
			);
		}
			
		/**
		 * Load an array of TableProjectRequestComplete objects,
		 * by ProviderId Index(es)
		 * @param integer $intProviderId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete[]
		*/
		public static function LoadArrayByProviderId($intProviderId, $objOptionalClauses = null) {
			// Call TableProjectRequestComplete::QueryArray to perform the LoadArrayByProviderId query
			try {
				return TableProjectRequestComplete::QueryArray(
					QQ::Equal(QQN::TableProjectRequestComplete()->ProviderId, $intProviderId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableProjectRequestCompletes
		 * by ProviderId Index(es)
		 * @param integer $intProviderId
		 * @return int
		*/
		public static function CountByProviderId($intProviderId) {
			// Call TableProjectRequestComplete::QueryCount to perform the CountByProviderId query
			return TableProjectRequestComplete::QueryCount(
				QQ::Equal(QQN::TableProjectRequestComplete()->ProviderId, $intProviderId)
			);
		}
			
		/**
		 * Load an array of TableProjectRequestComplete objects,
		 * by CompleteType Index(es)
		 * @param integer $intCompleteType
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete[]
		*/
		public static function LoadArrayByCompleteType($intCompleteType, $objOptionalClauses = null) {
			// Call TableProjectRequestComplete::QueryArray to perform the LoadArrayByCompleteType query
			try {
				return TableProjectRequestComplete::QueryArray(
					QQ::Equal(QQN::TableProjectRequestComplete()->CompleteType, $intCompleteType),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableProjectRequestCompletes
		 * by CompleteType Index(es)
		 * @param integer $intCompleteType
		 * @return int
		*/
		public static function CountByCompleteType($intCompleteType) {
			// Call TableProjectRequestComplete::QueryCount to perform the CountByCompleteType query
			return TableProjectRequestComplete::QueryCount(
				QQ::Equal(QQN::TableProjectRequestComplete()->CompleteType, $intCompleteType)
			);
		}
			
		/**
		 * Load an array of TableProjectRequestComplete objects,
		 * by RequestDate Index(es)
		 * @param QDateTime $dttRequestDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete[]
		*/
		public static function LoadArrayByRequestDate($dttRequestDate, $objOptionalClauses = null) {
			// Call TableProjectRequestComplete::QueryArray to perform the LoadArrayByRequestDate query
			try {
				return TableProjectRequestComplete::QueryArray(
					QQ::Equal(QQN::TableProjectRequestComplete()->RequestDate, $dttRequestDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableProjectRequestCompletes
		 * by RequestDate Index(es)
		 * @param QDateTime $dttRequestDate
		 * @return int
		*/
		public static function CountByRequestDate($dttRequestDate) {
			// Call TableProjectRequestComplete::QueryCount to perform the CountByRequestDate query
			return TableProjectRequestComplete::QueryCount(
				QQ::Equal(QQN::TableProjectRequestComplete()->RequestDate, $dttRequestDate)
			);
		}
			
		/**
		 * Load an array of TableProjectRequestComplete objects,
		 * by AcceptDate Index(es)
		 * @param QDateTime $dttAcceptDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete[]
		*/
		public static function LoadArrayByAcceptDate($dttAcceptDate, $objOptionalClauses = null) {
			// Call TableProjectRequestComplete::QueryArray to perform the LoadArrayByAcceptDate query
			try {
				return TableProjectRequestComplete::QueryArray(
					QQ::Equal(QQN::TableProjectRequestComplete()->AcceptDate, $dttAcceptDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableProjectRequestCompletes
		 * by AcceptDate Index(es)
		 * @param QDateTime $dttAcceptDate
		 * @return int
		*/
		public static function CountByAcceptDate($dttAcceptDate) {
			// Call TableProjectRequestComplete::QueryCount to perform the CountByAcceptDate query
			return TableProjectRequestComplete::QueryCount(
				QQ::Equal(QQN::TableProjectRequestComplete()->AcceptDate, $dttAcceptDate)
			);
		}
			
		/**
		 * Load an array of TableProjectRequestComplete objects,
		 * by DeclineDate Index(es)
		 * @param QDateTime $dttDeclineDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete[]
		*/
		public static function LoadArrayByDeclineDate($dttDeclineDate, $objOptionalClauses = null) {
			// Call TableProjectRequestComplete::QueryArray to perform the LoadArrayByDeclineDate query
			try {
				return TableProjectRequestComplete::QueryArray(
					QQ::Equal(QQN::TableProjectRequestComplete()->DeclineDate, $dttDeclineDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableProjectRequestCompletes
		 * by DeclineDate Index(es)
		 * @param QDateTime $dttDeclineDate
		 * @return int
		*/
		public static function CountByDeclineDate($dttDeclineDate) {
			// Call TableProjectRequestComplete::QueryCount to perform the CountByDeclineDate query
			return TableProjectRequestComplete::QueryCount(
				QQ::Equal(QQN::TableProjectRequestComplete()->DeclineDate, $dttDeclineDate)
			);
		}
			
		/**
		 * Load an array of TableProjectRequestComplete objects,
		 * by RetractDate Index(es)
		 * @param QDateTime $dttRetractDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete[]
		*/
		public static function LoadArrayByRetractDate($dttRetractDate, $objOptionalClauses = null) {
			// Call TableProjectRequestComplete::QueryArray to perform the LoadArrayByRetractDate query
			try {
				return TableProjectRequestComplete::QueryArray(
					QQ::Equal(QQN::TableProjectRequestComplete()->RetractDate, $dttRetractDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableProjectRequestCompletes
		 * by RetractDate Index(es)
		 * @param QDateTime $dttRetractDate
		 * @return int
		*/
		public static function CountByRetractDate($dttRetractDate) {
			// Call TableProjectRequestComplete::QueryCount to perform the CountByRetractDate query
			return TableProjectRequestComplete::QueryCount(
				QQ::Equal(QQN::TableProjectRequestComplete()->RetractDate, $dttRetractDate)
			);
		}
			
		/**
		 * Load an array of TableProjectRequestComplete objects,
		 * by ProjectFailedDate Index(es)
		 * @param QDateTime $dttProjectFailedDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete[]
		*/
		public static function LoadArrayByProjectFailedDate($dttProjectFailedDate, $objOptionalClauses = null) {
			// Call TableProjectRequestComplete::QueryArray to perform the LoadArrayByProjectFailedDate query
			try {
				return TableProjectRequestComplete::QueryArray(
					QQ::Equal(QQN::TableProjectRequestComplete()->ProjectFailedDate, $dttProjectFailedDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableProjectRequestCompletes
		 * by ProjectFailedDate Index(es)
		 * @param QDateTime $dttProjectFailedDate
		 * @return int
		*/
		public static function CountByProjectFailedDate($dttProjectFailedDate) {
			// Call TableProjectRequestComplete::QueryCount to perform the CountByProjectFailedDate query
			return TableProjectRequestComplete::QueryCount(
				QQ::Equal(QQN::TableProjectRequestComplete()->ProjectFailedDate, $dttProjectFailedDate)
			);
		}
			
		/**
		 * Load an array of TableProjectRequestComplete objects,
		 * by Status Index(es)
		 * @param integer $intStatus
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete[]
		*/
		public static function LoadArrayByStatus($intStatus, $objOptionalClauses = null) {
			// Call TableProjectRequestComplete::QueryArray to perform the LoadArrayByStatus query
			try {
				return TableProjectRequestComplete::QueryArray(
					QQ::Equal(QQN::TableProjectRequestComplete()->Status, $intStatus),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableProjectRequestCompletes
		 * by Status Index(es)
		 * @param integer $intStatus
		 * @return int
		*/
		public static function CountByStatus($intStatus) {
			// Call TableProjectRequestComplete::QueryCount to perform the CountByStatus query
			return TableProjectRequestComplete::QueryCount(
				QQ::Equal(QQN::TableProjectRequestComplete()->Status, $intStatus)
			);
		}
			
		/**
		 * Load an array of TableProjectRequestComplete objects,
		 * by BuyerId, ProviderId, ProjectId, Status Index(es)
		 * @param integer $intBuyerId
		 * @param integer $intProviderId
		 * @param integer $intProjectId
		 * @param integer $intStatus
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete[]
		*/
		public static function LoadArrayByBuyerIdProviderIdProjectIdStatus($intBuyerId, $intProviderId, $intProjectId, $intStatus, $objOptionalClauses = null) {
			// Call TableProjectRequestComplete::QueryArray to perform the LoadArrayByBuyerIdProviderIdProjectIdStatus query
			try {
				return TableProjectRequestComplete::QueryArray(
					QQ::AndCondition(
					QQ::Equal(QQN::TableProjectRequestComplete()->BuyerId, $intBuyerId),
					QQ::Equal(QQN::TableProjectRequestComplete()->ProviderId, $intProviderId),
					QQ::Equal(QQN::TableProjectRequestComplete()->ProjectId, $intProjectId),
					QQ::Equal(QQN::TableProjectRequestComplete()->Status, $intStatus)
					),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableProjectRequestCompletes
		 * by BuyerId, ProviderId, ProjectId, Status Index(es)
		 * @param integer $intBuyerId
		 * @param integer $intProviderId
		 * @param integer $intProjectId
		 * @param integer $intStatus
		 * @return int
		*/
		public static function CountByBuyerIdProviderIdProjectIdStatus($intBuyerId, $intProviderId, $intProjectId, $intStatus) {
			// Call TableProjectRequestComplete::QueryCount to perform the CountByBuyerIdProviderIdProjectIdStatus query
			return TableProjectRequestComplete::QueryCount(
				QQ::AndCondition(
				QQ::Equal(QQN::TableProjectRequestComplete()->BuyerId, $intBuyerId),
				QQ::Equal(QQN::TableProjectRequestComplete()->ProviderId, $intProviderId),
				QQ::Equal(QQN::TableProjectRequestComplete()->ProjectId, $intProjectId),
				QQ::Equal(QQN::TableProjectRequestComplete()->Status, $intStatus)
				)
			);
		}
			
		/**
		 * Load an array of TableProjectRequestComplete objects,
		 * by ProjectId Index(es)
		 * @param integer $intProjectId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableProjectRequestComplete[]
		*/
		public static function LoadArrayByProjectId($intProjectId, $objOptionalClauses = null) {
			// Call TableProjectRequestComplete::QueryArray to perform the LoadArrayByProjectId query
			try {
				return TableProjectRequestComplete::QueryArray(
					QQ::Equal(QQN::TableProjectRequestComplete()->ProjectId, $intProjectId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableProjectRequestCompletes
		 * by ProjectId Index(es)
		 * @param integer $intProjectId
		 * @return int
		*/
		public static function CountByProjectId($intProjectId) {
			// Call TableProjectRequestComplete::QueryCount to perform the CountByProjectId query
			return TableProjectRequestComplete::QueryCount(
				QQ::Equal(QQN::TableProjectRequestComplete()->ProjectId, $intProjectId)
			);
		}



		////////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Array via Many to Many)
		////////////////////////////////////////////////////




		//////////////////////////
		// SAVE, DELETE AND RELOAD
		//////////////////////////

		/**
		 * Save this TableProjectRequestComplete
		 * @param bool $blnForceInsert
		 * @param bool $blnForceUpdate
		 * @return int
		 */
		public function Save($blnForceInsert = false, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableProjectRequestComplete::GetDatabase();

			$mixToReturn = null;

			try {
				if ((!$this->__blnRestored) || ($blnForceInsert)) {
					// Perform an INSERT query
					$objDatabase->NonQuery('
						INSERT INTO `table_project_request_complete` (
							`buyer_id`,
							`provider_id`,
							`project_id`,
							`complete_type`,
							`message`,
							`request_date`,
							`accept_date`,
							`decline_date`,
							`retract_date`,
							`project_failed_date`,
							`status`
						) VALUES (
							' . $objDatabase->SqlVariable($this->intBuyerId) . ',
							' . $objDatabase->SqlVariable($this->intProviderId) . ',
							' . $objDatabase->SqlVariable($this->intProjectId) . ',
							' . $objDatabase->SqlVariable($this->intCompleteType) . ',
							' . $objDatabase->SqlVariable($this->strMessage) . ',
							' . $objDatabase->SqlVariable($this->dttRequestDate) . ',
							' . $objDatabase->SqlVariable($this->dttAcceptDate) . ',
							' . $objDatabase->SqlVariable($this->dttDeclineDate) . ',
							' . $objDatabase->SqlVariable($this->dttRetractDate) . ',
							' . $objDatabase->SqlVariable($this->dttProjectFailedDate) . ',
							' . $objDatabase->SqlVariable($this->intStatus) . '
						)
					');

					// Update Identity column and return its value
					$mixToReturn = $this->intId = $objDatabase->InsertId('table_project_request_complete', 'id');
				} else {
					// Perform an UPDATE query

					// First checking for Optimistic Locking constraints (if applicable)

					// Perform the UPDATE query
					$objDatabase->NonQuery('
						UPDATE
							`table_project_request_complete`
						SET
							`buyer_id` = ' . $objDatabase->SqlVariable($this->intBuyerId) . ',
							`provider_id` = ' . $objDatabase->SqlVariable($this->intProviderId) . ',
							`project_id` = ' . $objDatabase->SqlVariable($this->intProjectId) . ',
							`complete_type` = ' . $objDatabase->SqlVariable($this->intCompleteType) . ',
							`message` = ' . $objDatabase->SqlVariable($this->strMessage) . ',
							`request_date` = ' . $objDatabase->SqlVariable($this->dttRequestDate) . ',
							`accept_date` = ' . $objDatabase->SqlVariable($this->dttAcceptDate) . ',
							`decline_date` = ' . $objDatabase->SqlVariable($this->dttDeclineDate) . ',
							`retract_date` = ' . $objDatabase->SqlVariable($this->dttRetractDate) . ',
							`project_failed_date` = ' . $objDatabase->SqlVariable($this->dttProjectFailedDate) . ',
							`status` = ' . $objDatabase->SqlVariable($this->intStatus) . '
						WHERE
							`id` = ' . $objDatabase->SqlVariable($this->intId) . '
					');
				}

			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Update __blnRestored and any Non-Identity PK Columns (if applicable)
			$this->__blnRestored = true;


			// Return 
			return $mixToReturn;
		}

		/**
		 * Delete this TableProjectRequestComplete
		 * @return void
		 */
		public function Delete() {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Cannot delete this TableProjectRequestComplete with an unset primary key.');

			// Get the Database Object for this Class
			$objDatabase = TableProjectRequestComplete::GetDatabase();


			// Perform the SQL Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_project_request_complete`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($this->intId) . '');
		}

		/**
		 * Delete all TableProjectRequestCompletes
		 * @return void
		 */
		public static function DeleteAll() {
			// Get the Database Object for this Class
			$objDatabase = TableProjectRequestComplete::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_project_request_complete`');
		}

		/**
		 * Truncate table_project_request_complete table
		 * @return void
		 */
		public static function Truncate() {
			// Get the Database Object for this Class
			$objDatabase = TableProjectRequestComplete::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				TRUNCATE `table_project_request_complete`');
		}

		/**
		 * Reload this TableProjectRequestComplete from the database.
		 * @return void
		 */
		public function Reload() {
			// Make sure we are actually Restored from the database
			if (!$this->__blnRestored)
				throw new QCallerException('Cannot call Reload() on a new, unsaved TableProjectRequestComplete object.');

			// Reload the Object
			$objReloaded = TableProjectRequestComplete::Load($this->intId);

			// Update $this's local variables to match
			$this->BuyerId = $objReloaded->BuyerId;
			$this->ProviderId = $objReloaded->ProviderId;
			$this->ProjectId = $objReloaded->ProjectId;
			$this->intCompleteType = $objReloaded->intCompleteType;
			$this->strMessage = $objReloaded->strMessage;
			$this->dttRequestDate = $objReloaded->dttRequestDate;
			$this->dttAcceptDate = $objReloaded->dttAcceptDate;
			$this->dttDeclineDate = $objReloaded->dttDeclineDate;
			$this->dttRetractDate = $objReloaded->dttRetractDate;
			$this->dttProjectFailedDate = $objReloaded->dttProjectFailedDate;
			$this->intStatus = $objReloaded->intStatus;
		}



		////////////////////
		// PUBLIC OVERRIDERS
		////////////////////

				/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'Id':
					/**
					 * Gets the value for intId (Read-Only PK)
					 * @return integer
					 */
					return $this->intId;

				case 'BuyerId':
					/**
					 * Gets the value for intBuyerId (Not Null)
					 * @return integer
					 */
					return $this->intBuyerId;

				case 'ProviderId':
					/**
					 * Gets the value for intProviderId (Not Null)
					 * @return integer
					 */
					return $this->intProviderId;

				case 'ProjectId':
					/**
					 * Gets the value for intProjectId (Not Null)
					 * @return integer
					 */
					return $this->intProjectId;

				case 'CompleteType':
					/**
					 * Gets the value for intCompleteType (Not Null)
					 * @return integer
					 */
					return $this->intCompleteType;

				case 'Message':
					/**
					 * Gets the value for strMessage 
					 * @return string
					 */
					return $this->strMessage;

				case 'RequestDate':
					/**
					 * Gets the value for dttRequestDate 
					 * @return QDateTime
					 */
					return $this->dttRequestDate;

				case 'AcceptDate':
					/**
					 * Gets the value for dttAcceptDate 
					 * @return QDateTime
					 */
					return $this->dttAcceptDate;

				case 'DeclineDate':
					/**
					 * Gets the value for dttDeclineDate 
					 * @return QDateTime
					 */
					return $this->dttDeclineDate;

				case 'RetractDate':
					/**
					 * Gets the value for dttRetractDate 
					 * @return QDateTime
					 */
					return $this->dttRetractDate;

				case 'ProjectFailedDate':
					/**
					 * Gets the value for dttProjectFailedDate 
					 * @return QDateTime
					 */
					return $this->dttProjectFailedDate;

				case 'Status':
					/**
					 * Gets the value for intStatus (Not Null)
					 * @return integer
					 */
					return $this->intStatus;


				///////////////////
				// Member Objects
				///////////////////
				case 'Buyer':
					/**
					 * Gets the value for the TableUserProject object referenced by intBuyerId (Not Null)
					 * @return TableUserProject
					 */
					try {
						if ((!$this->objBuyer) && (!is_null($this->intBuyerId)))
							$this->objBuyer = TableUserProject::Load($this->intBuyerId);
						return $this->objBuyer;
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Provider':
					/**
					 * Gets the value for the TableUserProject object referenced by intProviderId (Not Null)
					 * @return TableUserProject
					 */
					try {
						if ((!$this->objProvider) && (!is_null($this->intProviderId)))
							$this->objProvider = TableUserProject::Load($this->intProviderId);
						return $this->objProvider;
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Project':
					/**
					 * Gets the value for the TableProject object referenced by intProjectId (Not Null)
					 * @return TableProject
					 */
					try {
						if ((!$this->objProject) && (!is_null($this->intProjectId)))
							$this->objProject = TableProject::Load($this->intProjectId);
						return $this->objProject;
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				////////////////////////////
				// Virtual Object References (Many to Many and Reverse References)
				// (If restored via a "Many-to" expansion)
				////////////////////////////


				case '__Restored':
					return $this->__blnRestored;

				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

				/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'BuyerId':
					/**
					 * Sets the value for intBuyerId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						$this->objBuyer = null;
						return ($this->intBuyerId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'ProviderId':
					/**
					 * Sets the value for intProviderId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						$this->objProvider = null;
						return ($this->intProviderId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'ProjectId':
					/**
					 * Sets the value for intProjectId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						$this->objProject = null;
						return ($this->intProjectId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'CompleteType':
					/**
					 * Sets the value for intCompleteType (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intCompleteType = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Message':
					/**
					 * Sets the value for strMessage 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strMessage = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'RequestDate':
					/**
					 * Sets the value for dttRequestDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttRequestDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'AcceptDate':
					/**
					 * Sets the value for dttAcceptDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttAcceptDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'DeclineDate':
					/**
					 * Sets the value for dttDeclineDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttDeclineDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'RetractDate':
					/**
					 * Sets the value for dttRetractDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttRetractDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'ProjectFailedDate':
					/**
					 * Sets the value for dttProjectFailedDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttProjectFailedDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Status':
					/**
					 * Sets the value for intStatus (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intStatus = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				///////////////////
				// Member Objects
				///////////////////
				case 'Buyer':
					/**
					 * Sets the value for the TableUserProject object referenced by intBuyerId (Not Null)
					 * @param TableUserProject $mixValue
					 * @return TableUserProject
					 */
					if (is_null($mixValue)) {
						$this->intBuyerId = null;
						$this->objBuyer = null;
						return null;
					} else {
						// Make sure $mixValue actually is a TableUserProject object
						try {
							$mixValue = QType::Cast($mixValue, 'TableUserProject');
						} catch (QInvalidCastException $objExc) {
							$objExc->IncrementOffset();
							throw $objExc;
						} 

						// Make sure $mixValue is a SAVED TableUserProject object
						if (is_null($mixValue->Id))
							throw new QCallerException('Unable to set an unsaved Buyer for this TableProjectRequestComplete');

						// Update Local Member Variables
						$this->objBuyer = $mixValue;
						$this->intBuyerId = $mixValue->Id;

						// Return $mixValue
						return $mixValue;
					}
					break;

				case 'Provider':
					/**
					 * Sets the value for the TableUserProject object referenced by intProviderId (Not Null)
					 * @param TableUserProject $mixValue
					 * @return TableUserProject
					 */
					if (is_null($mixValue)) {
						$this->intProviderId = null;
						$this->objProvider = null;
						return null;
					} else {
						// Make sure $mixValue actually is a TableUserProject object
						try {
							$mixValue = QType::Cast($mixValue, 'TableUserProject');
						} catch (QInvalidCastException $objExc) {
							$objExc->IncrementOffset();
							throw $objExc;
						} 

						// Make sure $mixValue is a SAVED TableUserProject object
						if (is_null($mixValue->Id))
							throw new QCallerException('Unable to set an unsaved Provider for this TableProjectRequestComplete');

						// Update Local Member Variables
						$this->objProvider = $mixValue;
						$this->intProviderId = $mixValue->Id;

						// Return $mixValue
						return $mixValue;
					}
					break;

				case 'Project':
					/**
					 * Sets the value for the TableProject object referenced by intProjectId (Not Null)
					 * @param TableProject $mixValue
					 * @return TableProject
					 */
					if (is_null($mixValue)) {
						$this->intProjectId = null;
						$this->objProject = null;
						return null;
					} else {
						// Make sure $mixValue actually is a TableProject object
						try {
							$mixValue = QType::Cast($mixValue, 'TableProject');
						} catch (QInvalidCastException $objExc) {
							$objExc->IncrementOffset();
							throw $objExc;
						} 

						// Make sure $mixValue is a SAVED TableProject object
						if (is_null($mixValue->Id))
							throw new QCallerException('Unable to set an unsaved Project for this TableProjectRequestComplete');

						// Update Local Member Variables
						$this->objProject = $mixValue;
						$this->intProjectId = $mixValue->Id;

						// Return $mixValue
						return $mixValue;
					}
					break;

				default:
					try {
						return parent::__set($strName, $mixValue);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Lookup a VirtualAttribute value (if applicable).  Returns NULL if none found.
		 * @param string $strName
		 * @return string
		 */
		public function GetVirtualAttribute($strName) {
			if (array_key_exists($strName, $this->__strVirtualAttributeArray))
				return $this->__strVirtualAttributeArray[$strName];
			return null;
		}



		///////////////////////////////
		// ASSOCIATED OBJECTS' METHODS
		///////////////////////////////





		////////////////////////////////////////
		// METHODS for SOAP-BASED WEB SERVICES
		////////////////////////////////////////

		public static function GetSoapComplexTypeXml() {
			$strToReturn = '<complexType name="TableProjectRequestComplete"><sequence>';
			$strToReturn .= '<element name="Id" type="xsd:int"/>';
			$strToReturn .= '<element name="Buyer" type="xsd1:TableUserProject"/>';
			$strToReturn .= '<element name="Provider" type="xsd1:TableUserProject"/>';
			$strToReturn .= '<element name="Project" type="xsd1:TableProject"/>';
			$strToReturn .= '<element name="CompleteType" type="xsd:int"/>';
			$strToReturn .= '<element name="Message" type="xsd:string"/>';
			$strToReturn .= '<element name="RequestDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="AcceptDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="DeclineDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="RetractDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="ProjectFailedDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="Status" type="xsd:int"/>';
			$strToReturn .= '<element name="__blnRestored" type="xsd:boolean"/>';
			$strToReturn .= '</sequence></complexType>';
			return $strToReturn;
		}

		public static function AlterSoapComplexTypeArray(&$strComplexTypeArray) {
			if (!array_key_exists('TableProjectRequestComplete', $strComplexTypeArray)) {
				$strComplexTypeArray['TableProjectRequestComplete'] = TableProjectRequestComplete::GetSoapComplexTypeXml();
				TableUserProject::AlterSoapComplexTypeArray($strComplexTypeArray);
				TableUserProject::AlterSoapComplexTypeArray($strComplexTypeArray);
				TableProject::AlterSoapComplexTypeArray($strComplexTypeArray);
			}
		}

		public static function GetArrayFromSoapArray($objSoapArray) {
			$objArrayToReturn = array();

			foreach ($objSoapArray as $objSoapObject)
				array_push($objArrayToReturn, TableProjectRequestComplete::GetObjectFromSoapObject($objSoapObject));

			return $objArrayToReturn;
		}

		public static function GetObjectFromSoapObject($objSoapObject) {
			$objToReturn = new TableProjectRequestComplete();
			if (property_exists($objSoapObject, 'Id'))
				$objToReturn->intId = $objSoapObject->Id;
			if ((property_exists($objSoapObject, 'Buyer')) &&
				($objSoapObject->Buyer))
				$objToReturn->Buyer = TableUserProject::GetObjectFromSoapObject($objSoapObject->Buyer);
			if ((property_exists($objSoapObject, 'Provider')) &&
				($objSoapObject->Provider))
				$objToReturn->Provider = TableUserProject::GetObjectFromSoapObject($objSoapObject->Provider);
			if ((property_exists($objSoapObject, 'Project')) &&
				($objSoapObject->Project))
				$objToReturn->Project = TableProject::GetObjectFromSoapObject($objSoapObject->Project);
			if (property_exists($objSoapObject, 'CompleteType'))
				$objToReturn->intCompleteType = $objSoapObject->CompleteType;
			if (property_exists($objSoapObject, 'Message'))
				$objToReturn->strMessage = $objSoapObject->Message;
			if (property_exists($objSoapObject, 'RequestDate'))
				$objToReturn->dttRequestDate = new QDateTime($objSoapObject->RequestDate);
			if (property_exists($objSoapObject, 'AcceptDate'))
				$objToReturn->dttAcceptDate = new QDateTime($objSoapObject->AcceptDate);
			if (property_exists($objSoapObject, 'DeclineDate'))
				$objToReturn->dttDeclineDate = new QDateTime($objSoapObject->DeclineDate);
			if (property_exists($objSoapObject, 'RetractDate'))
				$objToReturn->dttRetractDate = new QDateTime($objSoapObject->RetractDate);
			if (property_exists($objSoapObject, 'ProjectFailedDate'))
				$objToReturn->dttProjectFailedDate = new QDateTime($objSoapObject->ProjectFailedDate);
			if (property_exists($objSoapObject, 'Status'))
				$objToReturn->intStatus = $objSoapObject->Status;
			if (property_exists($objSoapObject, '__blnRestored'))
				$objToReturn->__blnRestored = $objSoapObject->__blnRestored;
			return $objToReturn;
		}

		public static function GetSoapArrayFromArray($objArray) {
			if (!$objArray)
				return null;

			$objArrayToReturn = array();

			foreach ($objArray as $objObject)
				array_push($objArrayToReturn, TableProjectRequestComplete::GetSoapObjectFromObject($objObject, true));

			return unserialize(serialize($objArrayToReturn));
		}

		public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) {
			if ($objObject->objBuyer)
				$objObject->objBuyer = TableUserProject::GetSoapObjectFromObject($objObject->objBuyer, false);
			else if (!$blnBindRelatedObjects)
				$objObject->intBuyerId = null;
			if ($objObject->objProvider)
				$objObject->objProvider = TableUserProject::GetSoapObjectFromObject($objObject->objProvider, false);
			else if (!$blnBindRelatedObjects)
				$objObject->intProviderId = null;
			if ($objObject->objProject)
				$objObject->objProject = TableProject::GetSoapObjectFromObject($objObject->objProject, false);
			else if (!$blnBindRelatedObjects)
				$objObject->intProjectId = null;
			if ($objObject->dttRequestDate)
				$objObject->dttRequestDate = $objObject->dttRequestDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttAcceptDate)
				$objObject->dttAcceptDate = $objObject->dttAcceptDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttDeclineDate)
				$objObject->dttDeclineDate = $objObject->dttDeclineDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttRetractDate)
				$objObject->dttRetractDate = $objObject->dttRetractDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttProjectFailedDate)
				$objObject->dttProjectFailedDate = $objObject->dttProjectFailedDate->__toString(QDateTime::FormatSoap);
			return $objObject;
		}




	}



	/////////////////////////////////////
	// ADDITIONAL CLASSES for QCubed QUERY
	/////////////////////////////////////

	class QQNodeTableProjectRequestComplete extends QQNode {
		protected $strTableName = 'table_project_request_complete';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableProjectRequestComplete';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'BuyerId':
					return new QQNode('buyer_id', 'BuyerId', 'integer', $this);
				case 'Buyer':
					return new QQNodeTableUserProject('buyer_id', 'Buyer', 'integer', $this);
				case 'ProviderId':
					return new QQNode('provider_id', 'ProviderId', 'integer', $this);
				case 'Provider':
					return new QQNodeTableUserProject('provider_id', 'Provider', 'integer', $this);
				case 'ProjectId':
					return new QQNode('project_id', 'ProjectId', 'integer', $this);
				case 'Project':
					return new QQNodeTableProject('project_id', 'Project', 'integer', $this);
				case 'CompleteType':
					return new QQNode('complete_type', 'CompleteType', 'integer', $this);
				case 'Message':
					return new QQNode('message', 'Message', 'string', $this);
				case 'RequestDate':
					return new QQNode('request_date', 'RequestDate', 'QDateTime', $this);
				case 'AcceptDate':
					return new QQNode('accept_date', 'AcceptDate', 'QDateTime', $this);
				case 'DeclineDate':
					return new QQNode('decline_date', 'DeclineDate', 'QDateTime', $this);
				case 'RetractDate':
					return new QQNode('retract_date', 'RetractDate', 'QDateTime', $this);
				case 'ProjectFailedDate':
					return new QQNode('project_failed_date', 'ProjectFailedDate', 'QDateTime', $this);
				case 'Status':
					return new QQNode('status', 'Status', 'integer', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

	class QQReverseReferenceNodeTableProjectRequestComplete extends QQReverseReferenceNode {
		protected $strTableName = 'table_project_request_complete';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableProjectRequestComplete';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'BuyerId':
					return new QQNode('buyer_id', 'BuyerId', 'integer', $this);
				case 'Buyer':
					return new QQNodeTableUserProject('buyer_id', 'Buyer', 'integer', $this);
				case 'ProviderId':
					return new QQNode('provider_id', 'ProviderId', 'integer', $this);
				case 'Provider':
					return new QQNodeTableUserProject('provider_id', 'Provider', 'integer', $this);
				case 'ProjectId':
					return new QQNode('project_id', 'ProjectId', 'integer', $this);
				case 'Project':
					return new QQNodeTableProject('project_id', 'Project', 'integer', $this);
				case 'CompleteType':
					return new QQNode('complete_type', 'CompleteType', 'integer', $this);
				case 'Message':
					return new QQNode('message', 'Message', 'string', $this);
				case 'RequestDate':
					return new QQNode('request_date', 'RequestDate', 'QDateTime', $this);
				case 'AcceptDate':
					return new QQNode('accept_date', 'AcceptDate', 'QDateTime', $this);
				case 'DeclineDate':
					return new QQNode('decline_date', 'DeclineDate', 'QDateTime', $this);
				case 'RetractDate':
					return new QQNode('retract_date', 'RetractDate', 'QDateTime', $this);
				case 'ProjectFailedDate':
					return new QQNode('project_failed_date', 'ProjectFailedDate', 'QDateTime', $this);
				case 'Status':
					return new QQNode('status', 'Status', 'integer', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

?>